//
//  LGBluetoothCentralManager.h
//  SportRing
//
//  Created by mykoma on 14-4-5.
//  Copyright (c) 2014年 HotOne. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import "YMSCBPeripheral.h"


@protocol LGBluetoothCentralManagerDelegate <NSObject>

@required

-(NSArray *)deviceFilterPrefixName;

-(NSDictionary *)validServicesUUIDs;

-(NSDictionary *)validCharacteristics;

@optional

-(void)didFindPeripheral:(YMSCBPeripheral *)peripheral;

-(void)didDisconnectWithDevice;

@end

@interface LGBluetoothCentralManager : NSObject <CBCentralManagerDelegate>

SHARED_INSTANCE;

@property (nonatomic, assign) id <LGBluetoothCentralManagerDelegate> delegate;

-(void)connectTo:(YMSCBPeripheral *)peripheral withBlock:(CompletionBlock)block;

-(void)listenForUUID:(CBUUID *)uuid
          block:(CompletionBlock)block;

-(void)disconnectWithDevice;

- (void)setNotifyValue:(BOOL)enabled
 forCharacteristicUUID:(CBUUID *)uuid
             withValue:(NSData *)data
            completion:(CompletionBlock)block;

-(void)updateCharacteristicUUID:(CBUUID *)uuid
                      withValue:(NSData *)data
                     completion:(CompletionBlock)block;

-(void)readValueForCharacteristicUUID:(CBUUID *)uuid
                           completion:(CompletionBlock)block;

@end
